//
//  UAConnection.m
//  Unidbaccess
//
//  Created by Toplica Tanasković on 12/13/08.
//  Copyright 2008 HOME. All rights reserved.
//

#import "UAConnection.h"


@implementation UAConnection

@synthesize connected;

- (id) initWithProperties: (NSDictionary *) aConnectionProperties {
	self = [super init];
	if (self) {
		connectionProperties = [aConnectionProperties copy];
		nativeConnection = NULL;
		connected = NO;
		lastError = nil;
	}
	
	return self;
}

- (void) dealloc {
	[self disconnect];
	[connectionProperties release];
	[lastError release];
	
	[super dealloc];
}

- (BOOL) connect {
	[NSException raise: @"NotImplementedException" format: @""];
	return NO;
}

- (void) disconnect {
	[NSException raise: @"NotImplementedException" format: @""];
}


- (UAStatement *) prepareStatement: (NSString *) aQueryString {
	[NSException raise: @"NotImplementedException" format: @""];
	
	return nil;
}

- (void) setLastError: (UAError *) newError {
	NSLog(@"Setting new error.");
	if (lastError != nil) {
		[lastError release];
	}
	lastError = [newError copy];
}

- (UAError *) lastError {
	NSLog(@"Returning last error.");
	if (lastError != nil) {
		UAError * retVal = [lastError copy];
		[lastError release];
		lastError = nil;
		return retVal;
	} else {
		return nil;
	}
}
@end
